<%@ page import ="java.sql.*" %>


<%
    String user = request.getParameter("uname");    
    String pwd = request.getParameter("pass");
    String email = request.getParameter("email");
    //String aform = request.getParameter("aform");
    String unoid = request.getParameter("unoid");
    
    Class.forName("com.mysql.jdbc.Driver");
    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/db5208",
            "root", "");
    Statement st = con.createStatement();
    String sql = "INSERT INTO  users(user_name, user_pass, email, user_id) VALUES(?, ?, ?, ?)";
    PreparedStatement pstmt = con.prepareStatement(sql);
    pstmt.setString(1, user);
    pstmt.setString(2, pwd);
    pstmt.setString(3, email);
    //pstmt.setString(4, aform);
    pstmt.setString(4, unoid);
    int i= pstmt.executeUpdate();
    if (i > 0) {
        //session.setAttribute("userid", user);
        response.sendRedirect("welcome.jsp");
       // out.print("Registration Successfull!"+"<a href='index.jsp'>Go to Login</a>");
    } else {
        response.sendRedirect("index.jsp");
    }
    

    

%>